package com.cy.pj.sys.Controller;


import com.cy.pj.sys.pojo.SysLog;
import com.cy.pj.sys.service.SysLogService;
import com.cy.pj.sys.web.pojo.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/log/")
public class SysLogController {
    @Autowired
    private SysLogService sysLogService;


    @GetMapping("{id}")
    public JsonResult doFindById(Long id){
        return new JsonResult(sysLogService.findById(id));
    }
    @DeleteMapping("{ids}")
    public JsonResult doDeleteById(Long...ids){
        sysLogService.deleteById(ids);
        return  new JsonResult("delete ok");
    }
    @GetMapping
    public JsonResult doFindLogs(SysLog sysLog){
        List<SysLog> list=sysLogService.findLogs(sysLog);
        return new JsonResult(list);
    }
}
